package com.cass.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cass.entity.Vo.studentVo;
import com.cass.entity.student;
import com.cass.mapper.studentMapper;
import com.cass.service.studentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 学生表 服务实现类
 * @author wangyou
 */
@RequiredArgsConstructor
@Service
public class studentServiceImpl extends ServiceImpl<studentMapper, student> implements studentService {
    private final studentMapper studentMapper;

    @Override
    public List<studentVo> listStudent() {
        return studentMapper.listStudent();
    }

    @Override
    @Transactional
    public void updateStudent(student student) {
        studentMapper.updateById(student);
    }

     @Override
    public student getStudentById(String studentNumber) {
        QueryWrapper<student> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("student_number", studentNumber);
        return getOne(queryWrapper);
    }
}
